﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Glorysoft.Auto.Xfw;
using Glorysoft.EAP.Core.Enums;
using Glorysoft.EAP.EAPClient.Common;
using Glorysoft.EAP.EAPClient.ViewModel;
using Serilog.Core;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;

namespace Glorysoft.EAP.EAPClient.Model
{
    public class C_LotInfo : ViewModelBase
    {
        private readonly Logger ServiceLogger = XfwContext.EapLogger;
        public C_LotInfo()
        {
            //SlotMaps = new ObservableCollection<SLotMap>();
            //for (int i = 1; i <= 25; i++)
            //{
            //    SlotMaps.Add(new SLotMap() {SlotId = i.ToString() });//eaf5fd
            //}



        }
        public RunService ClientInfo
        {
            get
            {
                return RunService.Current;
            }
        }
        public string eapid;
        public string EqpId
        {
            get { return eapid; }
            set
            {
                eapid = value;
                RaisePropertyChanged("EqpId");
            }
        }
        public string portid;
        public string xNameId;
        public string XNameId
        {
            get { return xNameId; }
            set
            {
                xNameId = value;
                RaisePropertyChanged("XNameId");
            }
        }
        public string portnumber;
        public string lotId;
        public string carrierId;
        public string reallotId;
        public Visibility lotVis = Visibility.Collapsed;
        public Visibility LotVis
        {
            get { return lotVis; }
            set
            {
                lotVis = value;
                RaisePropertyChanged("LotVis");
            }
        }
        public Visibility cassetteVis = Visibility.Collapsed;
        public Visibility CassetteVis
        {
            get { return cassetteVis; }
            set
            {
                cassetteVis = value;
                RaisePropertyChanged("CassetteVis");
            }
        }
        public string qty;
        public ProcessState lotStatus;
        public string lotsStatus;
        public string productId;
        public string testID;
        public string stageId;
        public string stepId;
        public string proberRecipe;
        public string testerProgram;
        public string probercard;
        public string priority;
        public string recipeId;
        public string reticleId;
        private string startDate;
        private string moveinTime;
        private string moveoutTime;
        private string totalWafers;
        private string currentWafer;
        private string currentQty;
        private string productver;
        public List<Core.Entities.LOSSINFOLIST> LOSSINFOLIST;
        public List<Core.Entities.UNITLIST> UNITLIST;

        public string samplePromptSize;
        public string SamplePromptSize
        {
            get { return samplePromptSize; }
            set
            {
                samplePromptSize = value;
                RaisePropertyChanged("SamplePromptSize");
            }
        }
        public string Productver
        {
            get { return productver; }
            set
            {
                productver = value;
                RaisePropertyChanged("Productver");
            }
        }
        public string StartDate
        {
            get { return startDate; }
            set
            {
                startDate = value;
                RaisePropertyChanged("StartDate");
            }
        }
        private string endDate;
        public string EndDate
        {
            get { return endDate; }
            set
            {
                endDate = value;
                RaisePropertyChanged("EndDate");
            }
        }
        public string MoveinTime
        {
            get { return moveinTime; }
            set
            {
                moveinTime = value;
                RaisePropertyChanged("MoveinTime");
            }
        }
        public string MoveoutTime
        {
            get { return moveoutTime; }
            set
            {
                moveoutTime = value;
                RaisePropertyChanged("MoveoutTime");
            }
        }
        public string PortId
        {
            get { return portid; }
            set
            {
                portid = value;
                RaisePropertyChanged("PortId");
            }
        }
        public string PortNumber
        {
            get { return portnumber; }
            set
            {
                portnumber = value;
                RaisePropertyChanged("PortNumber");
            }
        }
        public string LotId
        {
            get { return lotId; }
            set
            {
                lotId = value;
                RaisePropertyChanged("LotId");
            }
        }
        public string CarrierId
        {
            get { return carrierId; }
            set
            {
                carrierId = value;
                RaisePropertyChanged("CarrierId");
            }
        }
        public string RealLotId
        {
            get { return reallotId; }
            set
            {
                reallotId = value;
                RaisePropertyChanged("RealLotId");
            }
        }
        public string Priority
        {
            get { return priority; }
            set
            {
                priority = value;
                RaisePropertyChanged("priority");
            }

        }
        public string ProberRecipe
        {
            get { return proberRecipe; }
            set
            {
                proberRecipe = value;
                RaisePropertyChanged("ProberRecipe");
            }
        }
        public string Qty
        {
            get { return qty; }
            set
            {
                qty = value;
                RaisePropertyChanged("Qty");
            }
        }
        private string _LotColor = Consts.YELLOW;
        public string LotColor
        {
            get { return _LotColor; }
            set
            {
                _LotColor = value;
                RaisePropertyChanged("LotColor");
            }
        }
        public ProcessState LotStatus
        {
            get { return lotStatus; }
            set
            {
                lotStatus = value;
                if (Consts.RGYColorMap.ContainsKey(lotStatus))
                    LotColor = Consts.RGYColorMap[lotStatus];
                RaisePropertyChanged("LotStatus");
            }
        }
        private string userId;
        public string UserId
        {
            get { return userId; }
            set
            {
                userId = value;
                RaisePropertyChanged("UserId");
            }
        }
        private string state;
        public string State
        {
            get { return state; }
            set
            {
                state = value;
                RaisePropertyChanged("State");
            }
        }
        public string ProductId
        {
            get { return productId; }
            set
            {
                productId = value;
                RaisePropertyChanged("ProductId");
            }
        }
        public string TestID
        {
            get { return testID; }
            set
            {
                testID = value;
                RaisePropertyChanged("TestID");
            }
        }
        public string LotsStatus
        {
            get { return lotsStatus; }
            set
            {
                lotsStatus = value;
                RaisePropertyChanged("LotsStatus");
            }
        }
        public string StageId
        {
            get { return stageId; }
            set
            {
                stageId = value;
                RaisePropertyChanged("StageId");
            }
        }
        public string StepId
        {
            get { return stepId; }
            set
            {
                stepId = value;
                RaisePropertyChanged("StepId");
            }
        }
        public string TesterProgram
        {
            get { return testerProgram; }
            set
            {
                testerProgram = value;
                RaisePropertyChanged("testerProgram");
            }
        }
        public string Probercard
        {
            get { return probercard; }
            set
            {
                probercard = value;
                RaisePropertyChanged("Probercard");
            }
        }
        public string RecipeId
        {
            get { return recipeId; }
            set
            {
                recipeId = value;
                RaisePropertyChanged("RecipeId");
            }
        }
        public string ReticleId
        {
            get { return reticleId; }
            set
            {
                reticleId = value;
                RaisePropertyChanged("ReticleId");
            }
        }
        public string TotalWafers
        {
            get { return totalWafers; }
            set
            {
                totalWafers = value;
                RaisePropertyChanged("TotalWafers");
            }
        }
        public string CurrentWafer
        {
            get { return currentWafer; }
            set
            {
                currentWafer = value;
                RaisePropertyChanged("CurrentWafer");
            }
        }
        public string CurrentQty
        {
            get { return currentQty; }
            set
            {
                currentQty = value;
                RaisePropertyChanged("CurrentQty");
            }
        }
        private Visibility groupbox1 = Visibility.Hidden;
        public Visibility Groupbox1
        {
            get { return groupbox1; }
            set
            {
                groupbox1 = value;
                RaisePropertyChanged("Groupbox1");
            }
        }
        private Visibility groupbox2 = Visibility.Hidden;
        public Visibility Groupbox2
        {
            get { return groupbox2; }
            set
            {
                groupbox2 = value;
                RaisePropertyChanged("Groupbox2");
            }
        }
        /// <summary>
        /// 设备名
        /// </summary>
        private string listHearMsg = Consts.GetTranslation("Msg_RealtimeInfo");
        public string ListHearMsg
        {
            get { return listHearMsg; }
            set
            {
                listHearMsg = value;
                RaisePropertyChanged("ListHearMsg");
            }
        }
        /// <summary>
        /// 设备名
        /// </summary>
        private string boxHearMsg = Consts.GetTranslation("Msg_WaferInfo");
        public string BoxHearMsg
        {
            get { return boxHearMsg; }
            set
            {
                boxHearMsg = value;
                RaisePropertyChanged("BoxHearMsg");
            }
        }
        private ObservableCollection<SLotMap> slotMaps = new ObservableCollection<SLotMap>();
        public ObservableCollection<SLotMap> SlotMaps
        {
            get { return slotMaps; }
            set
            {
                slotMaps = value;
                RaisePropertyChanged("SlotMaps");
            }
        }

        private List<DefectProduct> defectedProduct = new List<DefectProduct>();
        public List<DefectProduct> DefectProduct
        {
            get { return defectedProduct; }
            set
            {
                defectedProduct = value;
                RaisePropertyChanged("DefectProduct");
            }
        }
        private List<SlotMap> allWafer = new List<SlotMap>();
        public List<SlotMap> AllWafer
        {
            get { return allWafer; }
            set
            {
                allWafer = value;
                RaisePropertyChanged("AllWafer");
            }
        }
        /// <summary>
        /// 扫描历史选中位置
        /// </summary>
        private InstantMsg _ItemSelected;
        public InstantMsg ItemSelected
        {
            get { return _ItemSelected; }
            set
            {
                _ItemSelected = value;
                RaisePropertyChanged("ItemSelected");
            }
        }
        private string CopyMsg = "";
        /// <summary>
        /// 实时消息提示
        /// </summary>
        private ObservableCollection<InstantMsg> msg = new ObservableCollection<InstantMsg>();
        public ObservableCollection<InstantMsg> MSG
        {
            get { return msg; }
            set
            {
                msg = value;
                RaisePropertyChanged("MSG");
            }
        }
        public void ShowMsg(MessageOrigin origin, MessageType type, string detail)
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(new Action(delegate
                {
                    if (MSG != null && MSG.Count > 0)
                    {
                        if (MSG[0] != null && !string.IsNullOrEmpty(MSG[0].Detail) && MSG[0].Detail == detail)
                            MSG.RemoveAt(0);
                    }
                    if (MSG.Count >= 1000)
                    {
                        MSG.RemoveAt(999);
                    }
                    MSG.Insert(0, new InstantMsg()
                    {
                        CurTime = DateTime.Now,
                        Title = origin,
                        Detail = detail,
                        FrontColor = Consts.MsgColorMap[type]
                    });
                    RaisePropertyChanged("MSG");
                    //ItemSelected = MSG[MSG.Count - 1];
                }));
            }
            catch (Exception ex)
            {
                ServiceLogger.Error(string.Format("{0}: {1}", GetType().Name, ex));
            }
        }
        public void Clear(string type = "0")
        {
            ClientInfo.EQPInfo.LotList[0].LotId = string.Empty;
            ClientInfo.EQPInfo.LotList[0].Qty = string.Empty;
            ClientInfo.EQPInfo.LotList[0].State = string.Empty;
            ClientInfo.EQPInfo.LotList[0].ProductId = string.Empty;
            ClientInfo.EQPInfo.LotList[0].TestID = string.Empty;
            ClientInfo.EQPInfo.LotList[0].ProberRecipe = string.Empty;
            ClientInfo.EQPInfo.LotList[0].TesterProgram = string.Empty;
            ClientInfo.EQPInfo.LotList[0].Probercard = string.Empty;
            ClientInfo.EQPInfo.LotList[0].LotsStatus = string.Empty;
            ClientInfo.EQPInfo.LotList[0].StageId = string.Empty;
            ClientInfo.EQPInfo.LotList[0].Priority = string.Empty;
            ClientInfo.EQPInfo.LotList[0].SlotMaps = null;
            ClientInfo.EQPInfo.LotList[0].UNITLIST = null;
            

            switch (type)
            {
                case "1":
                    ClientInfo.EQPInfo.LotList[0].UserId = string.Empty;
                    ClientInfo.EQPInfo.Btnclean = Visibility.Collapsed;
                    ClientInfo.EQPInfo.BtnOk = Visibility.Collapsed;
                    ClientInfo.EQPInfo.Loginout = Visibility.Collapsed;
                    ClientInfo.EQPInfo.Loginin = Visibility.Collapsed;
                    ClientInfo.EQPInfo.BtnEnd = Visibility.Collapsed;
                    ClientInfo.EQPInfo.AuotoProcess = false;
                    ClientInfo.EQPInfo.BGround = "Red";
                    break;
                default:
                    if (ClientInfo.EQPInfo.LotList[0].UserId == null || string.IsNullOrEmpty(ClientInfo.EQPInfo.LotList[0].UserId))
                    {
                        ClientInfo.EQPInfo.BtnOk = Visibility.Collapsed;
                        ClientInfo.EQPInfo.Btnclean = Visibility.Collapsed;
                    }
                    else
                    {
                        ClientInfo.EQPInfo.BtnOk = Visibility.Visible;
                        ClientInfo.EQPInfo.Btnclean = Visibility.Visible;
                    }
                    break;
            }
            // ClientInfo.EQPInfo.BtnOk = Visibility.Visible;

            #region old code 
            // StageId = null;       
            // LotId = null;
            // LotsStatus = null;
            // ProductId = null;
            // Probercard = null;
            // Qty = null;
            // TesterProgram = null;
            // ProberRecipe = null;
            // Priority = null;                                   
            //// LotVis = Visibility.Collapsed;
            // //LotStatus = ProcessState.UnKnow;
            // //LotColor = Consts.YELLOW;
            // //CassetteVis = Visibility.Collapsed;
            // //EndDate = null;
            // //StartDate = null;
            // ListHearMsg = Consts.GetTranslation("Msg_RealtimeInfo");
            // BoxHearMsg = Consts.GetTranslation("Msg_WaferInfo");
            // SlotMaps = null;          
            // //foreach (var slot in slotMaps)
            // //{
            // //   // slot.SlotColor = "#f7f7f7";
            // //    slot.WaferId = "";
            // //}
            #endregion
        }
        /// <summary>
        /// 手动取消作业
        /// </summary>
        private RelayCommand<string> skipCmd;
        public RelayCommand<string> SkipCmd
        {
            get
            {
                return skipCmd ?? (skipCmd = new RelayCommand<string>(SkipLot));
            }
        }
        public void SkipLot(string portid)
        {
            //登录权限，登录成功才能取消
            System.Windows.Application.Current.Dispatcher.Invoke(new Action(delegate
            {
                Controller.ShowWindow(new LoginViewModel());
            }));
            Model.RunService.Current.IsLoginOpen = true;
            //try
            //{
            //    if (CMessageBox.Show("是否确定手动清除该作业批次?", "确认信息", CMessageBoxButton.OKCancel) == CMessageBoxResult.OK)
            //    {
            //        ClientInitialization.Current._IService.SendRemoved(new BarcodeModel() { EQPID = EqpId, PORTID = portid, USERNAME = "EAPAUTO" });
            //    }
            //}
            //catch (Exception ex) 
            //{
            //    ServiceLogger.Error(GetType().Name + ex);
            //}
        }
        private RelayCommand userLoginCmd;
        public RelayCommand UsersLoginCmd
        {
            get
            {

                return userLoginCmd ?? (userLoginCmd = new RelayCommand(Login));

            }
        }
        public void Login()
        {
            C_LotInfo lot = new C_LotInfo();
            lot.LoginBox("1");
            if (ClientInfo.ClientLanguage == "CN")
                ClientInfo.LisenBtnContext = "登录";
            else
                ClientInfo.LisenBtnContext = "Login";
            ClientInfo.EQPInfo.Loginin = Visibility.Collapsed;
        }
        private RelayCommand<string> usersOutCmd;
        public RelayCommand<string> UsersOutCmd
        {
            get
            {
                return usersOutCmd ?? (usersOutCmd = new RelayCommand<string>(LogOut));
            }
        }
        public void LogOut(string obj)
        {
            try
            {
                var user = ClientInfo.EQPInfo.LotList[0].UserId;
                if (ClientInfo.ClientLanguage == "CN")
                {
                    ClientInfo.EQPInfo.Btnclean = Visibility.Visible;
                    ClientInfo.EQPInfo.BtnOk = Visibility.Collapsed;
                    ClientInfo.EQPInfo.Loginout = Visibility.Collapsed;
                    ClientInfo.EQPInfo.Loginin = Visibility.Visible;
                    ClientInfo.EQPInfo.LotList[0].UserId = null;
                }
                else
                {
                    ClientInfo.EQPInfo.Btnclean = Visibility.Visible;
                    ClientInfo.EQPInfo.BtnOk = Visibility.Collapsed;
                    ClientInfo.EQPInfo.Loginout = Visibility.Collapsed;
                    ClientInfo.EQPInfo.Loginin = Visibility.Visible;
                    ClientInfo.EQPInfo.LotList[0].UserId = null;
                }
                MainViewModel.Current.ShowMsg(MessageType.Normal, user + "：" + Consts.GetTranslation("Msg_LoginOutOK"), MessageOrigin.EAP);
            }
            catch (Exception ex)
            {
                ServiceLogger.Error(string.Format("{0}: {1}", GetType().Name, ex));
            }
        }
        /// <summary>
        /// 出站
        /// </summary>
        private RelayCommand<string> trackOutCmd;
        public RelayCommand<string> TrackOutCmd
        {
            get
            {
                return trackOutCmd ?? (trackOutCmd = new RelayCommand<string>(TrackOut));
            }
        }
        public void TrackOut(string portid)
        {
            var lots = ClientInfo.EQPInfo.LotList[0];
            List<Core.Entities.LOSSINFOLIST> loss = new List<Core.Entities.LOSSINFOLIST>();
            loss = lots.LOSSINFOLIST;
            if (loss == null || loss.Count == 0)
            {
                if (lots.LotStatus.ToString() != "Running")
                {
                    CMessageBox.Show(Consts.GetTranslation("Msg_NotTrickIn"));
                }
                else
                {
                    CMessageBox.Show(Consts.GetTranslation("Msg_LOSSINFOLIST"));
                }
            }
            else
            {
                if (ClientInfo.TrackOutBtn == "LotEnd")
                {
                    MainWindow.eapstate = "LotEnd";
                    //btnTrackOut.Content = "TrackOut";
                    ClientInfo.TrackOutBtn = "TrackOut";
                    return;
                }
                if (ClientInfo.TrackOutBtn == "TrackOut")
                {
                    ClientInfo.TrackOutBtn = "LotEnd";
                    MainWindow.traytransferDic.Remove(EQPStatus.currenteqpid);
                    MainWindow.eapstate = "TrackOut";
                    C_LotInfo lot = new C_LotInfo();
                    lot.TrackOutLogin("1");
                }
                if (ClientInfo.TrackOutBtn == "批次结束")
                {
                    MainWindow.eapstate = "LotEnd";
                    ClientInfo.TrackOutBtn = "出站";
                    return;
                }
                if (ClientInfo.TrackOutBtn == "出站")
                {
                    ClientInfo.TrackOutBtn = "批次结束";
                    MainWindow.traytransferDic.Remove(EQPStatus.currenteqpid);
                    MainWindow.eapstate = "TrackOut";
                    C_LotInfo lot = new C_LotInfo();
                    lot.TrackOutLogin("1");
                }
                //C_LotInfo lot = new C_LotInfo();
                //lot.TrackOutLogin("1");
            }
        }
        /// <summary>
        /// 作业前用户登录
        /// </summary>
        /// <param name="portid"></param>UsersLoginCmd
        public void LoginBox(string portid)
        {

            System.Windows.Application.Current.Dispatcher.Invoke(new Action(delegate
            {
                Controller.ShowWindow(new UserLoginViewModel());
            }));
            Model.RunService.Current.IsLoginOpen = true;
        }
        /// <summary>
        /// 手动出站设备用户登录
        /// </summary>
        /// <param name="portid"></param>
        public void TrackOutLogin(string portid)
        {
            //登录权限，登录成功才能取消
            System.Windows.Application.Current.Dispatcher.Invoke(new Action(delegate
            {
                Controller.ShowWindow(new TrackOutLoginViewModel(EQPStatus.currenteqpid + "/" + portid));
            }));
            Model.RunService.Current.IsLoginOpen = true;
        }
        public void SelectWaferBox()
        {

            System.Windows.Application.Current.Dispatcher.Invoke(new Action(delegate
            {
                Controller.ShowWindow(new SelectWaferViewModel());
            }));
        }

        #region  ClearCurrentLogCmd
        private RelayCommand clearCurrentLogCmd;
        public RelayCommand ClearCurrentLogCmd
        {
            get
            {
                return clearCurrentLogCmd ?? (clearCurrentLogCmd = new RelayCommand(ClearCurrentLog));
            }
        }
        private void ClearCurrentLog()
        {
            try
            {
                MSG.Remove(ItemSelected);
                ListHearMsg = MSG[0].Detail;
            }
            catch (Exception ex)
            {
                ServiceLogger.Error(string.Format("{0}: {1}", GetType().Name, ex));
            }
        }
        #endregion
        #region  ClearAllLogCmd
        private RelayCommand clearAllLogCmd;
        public RelayCommand ClearAllLogCmd
        {
            get
            {
                return clearAllLogCmd ?? (clearAllLogCmd = new RelayCommand(ClearAllLog));
            }
        }
        private void ClearAllLog()
        {
            try
            {
                MSG.Clear();
                ListHearMsg = Consts.GetTranslation("Msg_RealtimeInfo"); ;
            }
            catch (Exception ex)
            {
                ServiceLogger.Error(string.Format("{0}: {1}", GetType().Name, ex));
            }
        }
        #endregion
        /// <summary>
        /// 显示所有LOG
        /// </summary>
        private RelayCommand showAllLogCmd;
        public RelayCommand ShowAllLogCmd
        {
            get
            {
                return showAllLogCmd ?? (showAllLogCmd = new RelayCommand(ShowAllLog));
            }
        }
        private void ShowAllLog()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke(new Action(delegate
                {
                    GlobalData.Current.EqpName = XNameId;
                    GlobalData.Current.MSG = MSG;
                    Controller.ShowSubWindow(new LogWindowViewModel());
                }));
            }
            catch (Exception ex)
            {
                ServiceLogger.Error(string.Format("{0}: {1}", GetType().Name, ex));
            }
        }
        #region  CopyAllLogCmd
        private RelayCommand _CopyLogCmd;
        public RelayCommand CopyLogCmd
        {
            get
            {
                return _CopyLogCmd ?? (_CopyLogCmd = new RelayCommand(CopyLog));
            }
        }
        private void CopyLog()
        {
            try
            {
                if (ItemSelected != null)
                    CopyMsg += "[" + XNameId + "]" + ItemSelected.CurTime + " " + ItemSelected.Detail + " \r";
                if (CopyMsg != "")
                {
                    Clipboard.SetDataObject(CopyMsg);
                    CopyMsg = "";
                }
            }
            catch (Exception ex)
            {
                ServiceLogger.Error(string.Format("{0}: {1}", GetType().Name, ex)); ;
            }
        }
        private RelayCommand _CopyAllLogCmd;
        public RelayCommand CopyAllLogCmd
        {
            get
            {
                return _CopyAllLogCmd ?? (_CopyAllLogCmd = new RelayCommand(CopyAllLog));
            }
        }
        private void CopyAllLog()
        {
            try
            {
                if (MSG.Count > 0)
                {
                    foreach (InstantMsg str in MSG)
                        CopyMsg += "[" + XNameId + "]" + str.CurTime + " " + str.Detail + " \r";
                }
                if (CopyMsg != "")
                {
                    Clipboard.SetDataObject(CopyMsg);
                    CopyMsg = "";
                }
            }
            catch (Exception ex)
            {
                ServiceLogger.Error(string.Format("{0}: {1}", GetType().Name, ex));
            }
        }
        #endregion
    }
    public class SLotMap : ViewModelBase
    {
        public string slotId;
        public string SlotId
        {
            get { return slotId; }
            set
            {
                slotId = value;
                RaisePropertyChanged("SlotId");
            }
        }
        public string waferId;
        public string WaferId
        {
            get { return waferId; }
            set
            {
                waferId = value;
                RaisePropertyChanged("WaferId");
            }
        }
        public string waferState;
        public string WaferState
        {
            get { return waferState; }
            set
            {
                waferState = value;
                RaisePropertyChanged("WaferState");
            }
        }
        public string runState;
        public string RunState
        {
            get { return runState; }
            set
            {
                runState = value;
                RaisePropertyChanged("RunState");
            }
        }
        /// <summary>
        /// 唯一的编码
        /// </summary>
        public string waferCode;
        public string WaferCode
        {
            get { return waferCode; }
            set
            {
                waferCode = value;
                RaisePropertyChanged("WaferCode");
            }
        }

        public int passNo;
        public int PassNo
        {
            get { return passNo; }
            set
            {
                passNo = value;
                RaisePropertyChanged("PassNo");
            }
        }
        public bool? isSelect = false;
        public bool? IsSelect
        {
            get { return isSelect; }
            set
            {
                isSelect = value;
                RaisePropertyChanged("IsSelect");
            }
        }
    }

    public class LOSSINFOLIST : ViewModelBase
    {
        public string LOSSCODE;
        public string losscode
        {
            get { return LOSSCODE; }
            set
            {
                LOSSDESC = value;
                RaisePropertyChanged("losscode");
            }
        }

        public string LOSSDESC;
        public string lossdes
        {
            get { return LOSSDESC; }
            set
            {
                LOSSDESC = value;
                RaisePropertyChanged("lossdes");
            }
        }

        public string LOSSCOUNT;
        public string losscount
        {
            get { return LOSSCOUNT; }
            set
            {
                LOSSCOUNT = value;
                RaisePropertyChanged("losscount");
            }
        }

        public List<UNITLIST> UNITLIST;
    }
    public class UNITLIST : ViewModelBase
    {
        public string UNITID;
        public string unitid
        {
            get { return UNITID; }
            set
            {
                UNITID = value;
                RaisePropertyChanged("unitlist");
            }
        }
    }
    


}
